﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;

namespace SgMotionSample
{
    /// <summary>
    /// Implements the control scheme for sgMotion
    /// </summary>
    public class sgMotionInput : InputComponent
    {
        public sgMotionInput(Game game) : base(game)
        {
        }

        public bool NextAnimation
        {
            get { return (KeyPressed(Keys.Right) || PadPressed(Buttons.RightShoulder)); }
        }

        public bool PrevAnimation
        {
            get { return (KeyPressed(Keys.Left) || PadPressed(Buttons.LeftShoulder)); }
        }

        public float Zoom
        {
            get { return ScrollWheel; }
        }

        public bool Exit
        {
            get { return (KeyPressed(Keys.Escape) || PadPressed(Buttons.Back)); }
        }

        public bool NoInterpolation
        {
            get { return (KeyPressed(Keys.F1) || PadPressed(Buttons.DPadLeft)); }
        }

        public bool LinearInterpolation 
        {
            get { return (KeyPressed(Keys.F2) || PadPressed(Buttons.DPadUp)); }
        }

        public bool SphericalInterpolation
        {
            get { return (KeyPressed(Keys.F3) || PadPressed(Buttons.DPadRight)); }
        }

        public bool CubicInterpolation
        {
            get { return (KeyPressed(Keys.F4) || PadPressed(Buttons.DPadDown)); }
        }

        public bool Loop
        {
            get { return (KeyPressed(Keys.X) || PadPressed(Buttons.X)); }
        }

        public bool Direction
        {
            get { return (KeyPressed(Keys.Y) || PadPressed(Buttons.Y)); }
        }

        public float SpeedChange
        {
            get { return CurrentPad[(int)PlayerIndex.One].ThumbSticks.Right.Y + (CurrentKey.IsKeyDown(Keys.Up) ? 1f : 0f) + (CurrentKey.IsKeyDown(Keys.Down) ? -1f : 0f); }
        }

        public bool PausePlay
        {
            get { return (KeyPressed(Keys.Space) || PadPressed(Buttons.Start)); }
        }
    }
}
